<%= form_for(blog) do |f| %>
  <% if blog.errors.any? %>
    <% blog.errors.full_messages.each do |error| %>
      <%= js add_gritter(error, title: 'Pay attention!', sticky: false) %>
    <% end %>
  <% end %>

  <div class="form-group">
    <%= f.select :topic_id, Topic.all.collect { |p| [ p.title, p.id ] },{}, class: 'form-control' %>
    <!--<%= f.collection_select :topic_id, Topic.all, :id, :title,{ }, class: 'form-control' %>-->
  </div>

    <div class="form-group">
      <%= f.radio_button :status, 'draft' %>
      <%= f.label :status, 'Draft' %>
      &nbsp;&nbsp;
      <%= f.radio_button :status, 'published' %>
      <%= f.label :status, 'Published' %>
    </div>

  <div class="form-group">
    <%= f.label :title %>
    <%= f.text_field :title, class: 'form-control' %>
  </div>

  <div class="form-group">
    <%= f.label :body %>
    <!--<%= link_to '查看', "/check?md=", target: '_blank', id: 'go_check' %>-->
    <%= f.text_area :body, class: 'form-control', rows: 10 %>
  </div>

  <div class="form-group">
    <%= f.submit '提交', class: 'btn btn-primary' %>
  </div>
<% end %>
